using MicroMsg.Manager;
using MicroMsg.Resource.@string;
using MicroMsg.Storage;
using MicroMsg.UI.UserContrl;
using MicroMsg.UI.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.Page
{
	public class ChooseAContactToSendImgPage : ChatContainerPage
	{
		private const string TAG = "ChooseAContactToSendImgPage";
		private string imageUrl;
		private Contact mContact;
		private List<UIElement> mUiToHideList;
		internal Grid LayoutRoot;
		internal Grid LayoutContent;
		internal panelTitle2Line panelTitle;
		internal Grid ContentPanel;
		internal ContactsView mContactView;
		private bool _contentLoaded;
		public ChooseAContactToSendImgPage()
		{
			this.InitializeComponent();
			this.mContactView.mNFilterContactsType = 4;
			base.add_Loaded(new RoutedEventHandler(this.ChooseAContactToSendImgPage_Loaded));
		}
		protected override void OnPageIn(object[] object_0)
		{
			if (object_0 != null && Enumerable.Count<object>(object_0) == 1)
			{
				this.imageUrl = (string)object_0[0];
			}
			this.LayoutRoot.set_Background(R.theme.COMMON_SECONDLEVEL_BK_BRUSH);
		}
		private void ChooseAContactToSendImgPage_Loaded(object sender, RoutedEventArgs e)
		{
			List<string> list = new List<string>();
			list.Add(AccountMgr.strUsrName);
			ContactsView.resetCheckedList(list);
			this.mContactView.mClickToAddCallBack += new MMUIEvent(this.mContactView_mClickToAddCallBack);
		}
		private object mContactView_mClickToAddCallBack(object sender, object object_0)
		{
			this.mContact = (object_0 as Contact);
			if (this.mContact == null)
			{
				return null;
			}
			MMMessageBox mMMessageBox = MMMessageBox.Show(strings.Contacts_ConfirmTitle + ContactHelper.getDisplayName(this.mContact.strUsrName, null), "", true, strings.COM_Yes, strings.COM_No);
			mMMessageBox.ReturnEvent = new DlgReturnEvent(this.sendComfirmDlgReturn);
			return null;
		}
		public void sendComfirmDlgReturn(DlgReturnEventArg dlgReturnEventArg_0)
		{
			if (MMMessageBox.GetUserClickResult(dlgReturnEventArg_0) == 0)
			{
				ChatContainerPage.GoToChatPage(this, this.mContact.strUsrName, null, null, this.imageUrl);
			}
		}
		public override List<UIElement> GetBkContents()
		{
			if (this.mUiToHideList == null)
			{
				this.mUiToHideList = new List<UIElement>();
				this.mUiToHideList.Add(this.LayoutContent);
			}
			return this.mUiToHideList;
		}
		public override Panel GetChatContainerPanel()
		{
			return this.LayoutRoot;
		}
		protected override void resumeFromChat()
		{
			this.mContactView.Focus();
			UIDelayService.getInstance().DoDelayAction();
		}
		protected override void OnBackKeyPress(CancelEventArgs cancelEventArgs_0)
		{
			base.OnBackKeyPress(cancelEventArgs_0);
		}
		protected override void OnPageOut()
		{
			base.PreOnPageOut();
		}
		protected override void OnPageForward(Uri targetPage)
		{
			base.PreOnPageForward(targetPage);
		}
		protected override void OnPageBack()
		{
			base.PreOnPageBack();
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/Plugin/Sns/Album/UI/ChooseAContactToSendImgPage.xaml", 2));
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
			this.LayoutContent = (Grid)base.FindName("LayoutContent");
			this.panelTitle = (panelTitle2Line)base.FindName("panelTitle");
			this.ContentPanel = (Grid)base.FindName("ContentPanel");
			this.mContactView = (ContactsView)base.FindName("mContactView");
		}
	}
}
